formal grammar

Terms from Artificial Intelligence: humans at the heart of algorithms

Page numbers are for draft copy at present; they will be replaced with correct numbers when final book is formatted. Chapter numbers are correct and will not change now.

A formal grammar is a set of fixed rules that define the valid constructions in a languages. This may be used in natural language processing to model an existing language. It may also be used to define an artificial language, in particular for programming languages.

Portion of formal grammar for a simple programming language:


expression ::== expression | expression operator expression | '(' expression ')'
statement ::== 'IF' expression 'THEN' statements 'ELSE' statments 'FI' | 'LET' variable '=' expression
statements ::== statement | statement ';' statements

xxx

Used in Chap. 13: pages 216, 218